function replaceVariable(ast,proxyData){
    let getKeyRS=/\{\{(.+?)\}\}/g
    if(ast.tag===1){
        // 对AST的子元素进行递归    
        for(let i=0;i<ast.children.length;i++){
            replaceVariable(ast.children[i],proxyData)
        }
    }
    if(ast.tag===3){
        // 进行数据替换
        ast.text=ast.text.replace(getKeyRS,function(match,argOne){
            return keyToValue(argOne,proxyData)
        })
    }
}

function keyToValue(path,proxyData){
    let keyArr=path.split('.')
    let value=proxyData
    for(let i=0;i<keyArr.length;i++){
        value=value[keyArr[i]]                
    }
    return value
}

export default replaceVariable